package com.gusti.mensajes.model;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import com.gusti.mensajes.persistence.model.AbstractModelObject;

/**
 * 
 * @author gusti
 *
 */
@Entity
public class ConversationThread extends AbstractModelObject {

	@ManyToOne
	private User participantOne;
	@ManyToOne
	private User participantTwo;
	@OneToMany( mappedBy="conversationThread", fetch=FetchType.EAGER, cascade=CascadeType.ALL )
	private List<Message> messages;

	public User getParticipantOne() {
		return participantOne;
	}
	public void setParticipantOne(User participantOne) {
		this.participantOne = participantOne;
	}
	public User getParticipantTwo() {
		return participantTwo;
	}
	public void setParticipantTwo(User participantTwo) {
		this.participantTwo = participantTwo;
	}
	public List<Message> getMessages() {
		return messages;
	}
	public void setMessages(List<Message> messages) {
		this.messages = messages;
	}
}
